home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 019a / amac40.zip / SZR.BAT < prev    next >
DOS Batch File  |  1991-05-16  |  4KB  |  107 lines

  1. :SZR.BAT  Search/Replace ZIP Files                             May 16, 1991
  2. :
  3. :1) SYNTAX:                          SRZ.BAT %1 %2 %3
  4. :                                  ┌──────────┘  │  └───────────┐
  5. :             (Mode)              %1            %2             %3
  6. :                            Search Text     Replace Text   ZIP Name
  7. :         ----------------   -------------   ------------   --------
  8. :      a) Query                   [ ]           [ ]            [ ]
  9. :      b) Partial Query      Search Text        [ ]            [ ]
  10. :      c) Partial Query      Search Text     Replace Text      [ ]
  11. :      d) All command line   Search Text     Replace Text   ZIP Name
  12. :
  13. :         where:    %1  - Search Text
  14. :                   %2  - Replace Text
  15. :                   %3  - ZIP Name, no extension
  16. :                   [ ] - entered at query prompt
  17. :2) Requires FGREP.COM    INPUT.COM    DX.EXE   PKZIP.EXE  PKUNZIP.EXE
  18. :            SRCH29.MAC
  19. :
  20. :*******************************************************************************
  21. :* Environment Variable        Action                                          *
  22. :* --------------------------- ----------------------------------------------- *
  23. :* set srmac=                  macro files are located in current directory    *
  24. :* set srmac=c:\mac\           macro files are located in c:\mac\ directory    *
  25. :* set sztemp=                 uses default c:\$zip$ for temporary directory   *
  26. :* set sztemp=e:\name          uses e:\name for temporary directory            *
  27. :*******************************************************************************
  28. :
  29. @echo OFF
  30. cls
  31. set S~~=%1
  32. set R~~=%2
  33. set file=%3
  34. break on
  35. if "%sztemp%" == "" set sztemp= c:\$zip$
  36. if     "%1" == ""    echo Search Text: [{Blank} terminates batch file]
  37. if not "%1" == ""    if not "%2" == "" goto 2b
  38. if not "%1" == ""    goto 1a
  39. INPUT.COM Search Text=/b
  40. if errorlevel=1 goto 6a
  41. set S~~=%ans%
  42. goto 2a
  43. :1a
  44. echo Search Text=%S~~%
  45. :2a
  46. set ans=
  47. if "%2" == "" echo Replace Text: [{Blank} terminates batch file]
  48. INPUT.COM Replace Text=/b
  49. if errorlevel=1 goto 6a
  50. set R~~=%ans%
  51. :2b
  52.  
  53. set ans=
  54. if not "%3" == "" goto 2c
  55. echo ZIP Name(s): [ZIP Name(s), no ZIP extn]  [{Blank} terminates batch file]
  56. INPUT.COM ZIP Name=/b
  57. if errorlevel=1 goto 6a
  58. set file=%ans%
  59. :2c
  60. if "%file%" == ""  goto 6a
  61. if not exist %file%.ZIP goto 6a
  62. :4a
  63. CLS
  64. echo Search Text   = %S~~%
  65. echo Replace Text  = %R~~%
  66. echo ZIP Name      = %file%.ZIP
  67.  
  68. if not exist %sztemp%\nul md %sztemp%
  69. PKUNZIP.EXE -o %file% %sztemp%
  70. echo.
  71. DX.EXE %sztemp% //v-/fattr:!a-/he:1/st:1/out:nul
  72. DX.EXE %sztemp%\*.exe *.com *.zip *.mac *.arc//v-/del/he:1/st:1/out:nul
  73. echo.
  74. FGREP.COM -fl %S~~% %sztemp%\*.* >c:\$.ql
  75. set >c:\$
  76. copy c:\$.ql c:\!
  77. Q.EXE C:\! /E%srmac%SRCH29.MAC /L%srmac%SRCH29.MAC
  78. echo.
  79. echo.
  80. DX.EXE %sztemp%\*.* //at:!a/he:1/st:1/sing
  81. echo.
  82. echo Answer: [G]o non-stop Adds above files to %3.ZIP, or [Y]es, [N]o,  ^C
  83. DX.EXE %sztemp%\;.bak //ex-/at:!a/run:'pkzip -f %file% %sztemp%\$n'/he:1/st:1
  84. echo Deleting temporary files and removing temporary directory %sztemp% . . .
  85. echo y | erase %sztemp%\*.* >nul
  86. rd %sztemp%
  87. if exist %sztemp%\nul echo Directory %sztemp% still exists . . .
  88. erase c:\!
  89. erase c:\$.*
  90. goto 7a
  91. :6a
  92. echo.
  93. if     "%S~~%"  == ""   echo Must specify Search Text . . . .
  94. if     "%R~~%"  == ""   echo Must specify Replace Text . . . .
  95. if not exist %file%.zip echo Can't Find ZIP_File %file%.zip . . . .
  96. if     "%file%" == ""   echo Must Specify ZIP_File . . . .
  97. echo Search──INCOMPLETE──
  98. goto 8a
  99. :7a
  100. echo.
  101. echo Search/Replace──Complete──
  102. PKUNZIP.EXE -vd %file%
  103. :8a
  104. echo.
  105. break off
  106. echo.
  107.